}
static GskRenderNode *
-gtk_snapshot_pop_internal (GtkSnapshot *snapshot)
+gtk_snapshot_pop_internal (GtkSnapshot *snapshot,
+ gboolean is_texture_pop)
{
GtkSnapshotState *state;
GskRenderNode *node;
g_warning ("Too many gtk_snapshot_save() calls. %u saves remaining.", forgotten_restores);
}
+ if (is_texture_pop && (state->collect_func != gtk_snapshot_collect_gl_shader_texture))
+ {
+ g_critical ("Unexpected call to gtk_snapshot_gl_shader_pop_texture().");
+ return NULL;
+ }
+ else if (!is_texture_pop && (state->collect_func == gtk_snapshot_collect_gl_shader_texture))
+ {
+ g_critical ("Expected a call to gtk_snapshot_gl_shader_pop_texture().");
+ return NULL;
+ }
+
return gtk_snapshot_pop_one (snapshot);
}
GskRenderNode *
gtk_snapshot_pop_collect (GtkSnapshot *snapshot)
{
- GskRenderNode *result = gtk_snapshot_pop_internal (snapshot);
+ GskRenderNode *result = gtk_snapshot_pop_internal (snapshot, FALSE);
return result;
}
{
GskRenderNode *result;
- result = gtk_snapshot_pop_internal (snapshot);
+ result = gtk_snapshot_pop_internal (snapshot, FALSE);
/* We should have exactly our initial state */
if (!gtk_snapshot_states_is_empty (&snapshot->state_stack))
void
gtk_snapshot_pop (GtkSnapshot *snapshot)
{
- GtkSnapshotState *state = gtk_snapshot_get_current_state (snapshot);
GskRenderNode *node;
- if (state->collect_func == gtk_snapshot_collect_gl_shader_texture)
- g_warning ("Not enough calls to gtk_snapshot_gl_shader_pop_texture().");
-
- node = gtk_snapshot_pop_internal (snapshot);
+ node = gtk_snapshot_pop_internal (snapshot, FALSE);
if (node)
gtk_snapshot_append_node_internal (snapshot, node);
void
gtk_snapshot_gl_shader_pop_texture (GtkSnapshot *snapshot)
{
- GtkSnapshotState *state = gtk_snapshot_get_current_state (snapshot);
G_GNUC_UNUSED GskRenderNode *node;
- if (state->collect_func != gtk_snapshot_collect_gl_shader_texture)
- {
- g_warning ("Too many calls to gtk_snapshot_gl_shader_pop_texture().");
- return;
- }
-
- g_assert (state->collect_func == gtk_snapshot_collect_gl_shader_texture);
-
- node = gtk_snapshot_pop_internal (snapshot);
+ node = gtk_snapshot_pop_internal (snapshot, TRUE);
g_assert (node == NULL);
}